package com.sc.nft.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.sc.nft.dto.TaskPrizeDTO;
import com.sc.nft.entity.Task;
import lombok.extern.slf4j.Slf4j;
import com.sc.nft.entity.TaskPrize;
import com.sc.nft.mapper.TaskPrizeMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 任务奖励表(sc_task_prize)数据DAO
 *
 * @author 张翔宇
 * @since 2023-03-29 11:14:52
 * @description 由 Mybatisplus Code Generator 创建
 */
@Slf4j
@Repository
public class TaskPrizeDao extends ServiceImpl<TaskPrizeMapper, TaskPrize> {

    //删除任务下奖励
    public void deleteByTaskId(Long taskId) {
        LambdaUpdateWrapper<TaskPrize> wrapper = new LambdaUpdateWrapper<>();
        wrapper.eq(TaskPrize::getTaskId,taskId);
        remove(wrapper);
    }

    public List<TaskPrize> getTaskPrize(Long taskId){
        LambdaQueryWrapper<TaskPrize> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(TaskPrize::getTaskId,taskId);
        return list(wrapper);

    }

}